package com.scsj.supermarket.view.activity.cooperationmodel;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.google.gson.Gson;
import com.scsj.supermarket.R;
import com.scsj.supermarket.base.CircleMasterCommitBase;
import com.scsj.supermarket.bean.CircleMasterCommitBean;
import com.scsj.supermarket.bean.RequestTobeCircleManBean;
import com.scsj.supermarket.presenter.CircleMasterCommitPresenter;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;

import okhttp3.RequestBody;

/**
 * 圈主注册3
 */
public class BusinessCircleMasterRegisterActivity3 extends BaseActivity implements View.OnClickListener, CircleMasterCommitBase.IView{
    private RequestTobeCircleManBean.UserBankCardForApplyBean userBankCardForApplyBean;
    private CircleMasterCommitPresenter circleMasterCommitPresenter;
    private RequestTobeCircleManBean requestTobeCircleManBean;
    private RequestTobeCircleManBean.TradeAreaApplyBean tradeAreaApplyBean;
    private Button commitBtn;
    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_business_circle_master_register3);
//        ScreenAdapterTools.getInstance().loadView((ViewGroup) getWindow().getDecorView());
        //ScreenAdapterTools.getInstance().reset(this);//如果希望android7.0分屏也适配的话,加上这句
        initToolbar();
        setToolbarTitle("圈主注册");
        hasBack(true);
    }

    @Override
    protected void initView() {
        circleMasterCommitPresenter= new CircleMasterCommitPresenter(this);
        userBankCardForApplyBean= (RequestTobeCircleManBean.UserBankCardForApplyBean) getIntent().getSerializableExtra("userBankCardInfo");
        tradeAreaApplyBean= (RequestTobeCircleManBean.TradeAreaApplyBean) getIntent().getSerializableExtra("tradeAreaInfo2");
        commitBtn= findViewById(R.id.commit_btn);
    }

    @Override
    protected void initListener() {
        commitBtn.setOnClickListener(this);
    }

    @Override
    protected void initData() {

    }
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.commit_btn:
                //提交审核
                Gson gson = new Gson();
                requestTobeCircleManBean= new RequestTobeCircleManBean();
                requestTobeCircleManBean.setUserBankCardForApply(userBankCardForApplyBean);
                requestTobeCircleManBean.setTradeAreaApply(tradeAreaApplyBean);

                //选择的商圈id
                Log.e("打印一下看看：：",tradeAreaApplyBean.getTradeAreaId()+"88");
                //开户银行
                Log.e("打印一下看看123：",userBankCardForApplyBean.getAccountOpening()+"88");
                String obj = gson.toJson(requestTobeCircleManBean);
                RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json;charset=utf-8"), obj);
                circleMasterCommitPresenter.deliverData(this,body);
                break;
        }
    }

    @Override
    public void showSuccessMsg(String s, CircleMasterCommitBean circleMasterCommitBean) {

    }

    @Override
    public void showErrorMsg(String s) {

    }
}
